<?php
declare (strict_types = 1);

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Queue as QueueFacade;

class Queue extends Command
{
    protected function configure()
    {
        $this->setName('queue:test')
            ->setDescription('Test queue job');
    }

    protected function execute(Input $input, Output $output)
    {
        $output->writeln('Pushing test job to queue...');
        
        // 推送测试任务到队列
        $jobData = [
            'type' => 'test',
            'data' => 'Hello Queue!'
        ];
        
        $isSuccess = QueueFacade::push('\app\common\Queue@fire', $jobData, 'default');
        
        if ($isSuccess !== false) {
            $output->writeln('Test job pushed successfully');
        } else {
            $output->writeln('Failed to push test job');
        }
    }
} 